package cn.xcyy.itcc.fallback;

import cn.xcyy.itcc.doc.CourseDoc;
import cn.xcyy.itcc.enums.GlodalErrorCode;
import cn.xcyy.itcc.feign.CourseEsFeignClien;
import cn.xcyy.itcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class CourseEsFallbackFactory implements FallbackFactory<CourseEsFeignClien> {
    @Override
    public CourseEsFeignClien create(Throwable throwable) {
        return new CourseEsFeignClien() {
            @Override
            public JSONResult courseEsAdd(CourseDoc courseDoc) {
                return JSONResult.error(GlodalErrorCode.NO);
            }

            @Override
            public JSONResult searchMediaFiles(List<Long> courseChapterIds) {
                return JSONResult.error(GlodalErrorCode.NO);
            }
        };
    }
}
